package action.plan;

import java.util.List;

import org.springframework.security.context.SecurityContextHolder;

import persistence.model.TdfkfaExpertList;
import presentation.extendmodel.TdfkfaMainEx;
import service.ExpertService;
import service.PlanService;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class ListOwnJudgingPlanAction extends ActionSupport {

    private static final long serialVersionUID = 1L;

    private List<TdfkfaMainEx> planList;

    private PlanService planService;

    private ExpertService expertService;

    private String expertId;

    public String execute() throws Exception {

    	String username = SecurityContextHolder.getContext().getAuthentication().getName();
    	TdfkfaExpertList expert = expertService.getExpertByUsername(username);
    	if (expert != null) {
    		planList = planService.getOwnJudgingPlanList(expert.getExpertid());
    	}
        return Action.SUCCESS;
    }

    public List<TdfkfaMainEx> getPlanList() {
        return planList;
    }

    public void setPlanList(List<TdfkfaMainEx> planList) {
        this.planList = planList;
    }

    public void setPlanService(PlanService planService) {
        this.planService = planService;
    }

    public String getExpertId() {
        return expertId;
    }

    public void setExpertId(String expertId) {
        this.expertId = expertId;
    }

	public void setExpertService(ExpertService expertService) {
		this.expertService = expertService;
	}

}
